package com.ruoyi.category.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.category.mapper.GoodsCategoryMapper;
import com.ruoyi.category.domain.GoodsCategory;
import com.ruoyi.category.service.IGoodsCategoryService;

/**
 * 商品类别Service业务层处理
 * 
 * @author 刘晋羽
 * @date 2025-08-12
 */
@Service
public class GoodsCategoryServiceImpl implements IGoodsCategoryService 
{
    @Autowired
    private GoodsCategoryMapper goodsCategoryMapper;

    /**
     * 查询商品类别
     * 
     * @param categoryId 商品类别主键
     * @return 商品类别
     */
    @Override
    public GoodsCategory selectGoodsCategoryByCategoryId(String categoryId)
    {
        return goodsCategoryMapper.selectGoodsCategoryByCategoryId(categoryId);
    }

    /**
     * 查询商品类别列表
     * 
     * @param goodsCategory 商品类别
     * @return 商品类别
     */
    @Override
    public List<GoodsCategory> selectGoodsCategoryList(GoodsCategory goodsCategory)
    {
        return goodsCategoryMapper.selectGoodsCategoryList(goodsCategory);
    }

    /**
     * 新增商品类别
     * 
     * @param goodsCategory 商品类别
     * @return 结果
     */
    @Override
    public int insertGoodsCategory(GoodsCategory goodsCategory)
    {
        goodsCategory.setCreateTime(DateUtils.getNowDate());
        return goodsCategoryMapper.insertGoodsCategory(goodsCategory);
    }

    /**
     * 修改商品类别
     * 
     * @param goodsCategory 商品类别
     * @return 结果
     */
    @Override
    public int updateGoodsCategory(GoodsCategory goodsCategory)
    {
        return goodsCategoryMapper.updateGoodsCategory(goodsCategory);
    }

    /**
     * 批量删除商品类别
     * 
     * @param categoryIds 需要删除的商品类别主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCategoryByCategoryIds(String[] categoryIds)
    {
        return goodsCategoryMapper.deleteGoodsCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除商品类别信息
     * 
     * @param categoryId 商品类别主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCategoryByCategoryId(String categoryId)
    {
        return goodsCategoryMapper.deleteGoodsCategoryByCategoryId(categoryId);
    }
}
